<template>
  <view :class="[`${prefixCls}-user-info-container`]">
    <uv-list>
      <uv-list-item
        :title="userInfo.user_name"
        :note="userInfo.current_dept_name"
        thumb="https://via.placeholder.com/100x100.png/3c9cff/fff"
        thumb-size="lg"
        rightText="右侧文字"
        border
      >
      </uv-list-item>
      <uv-list-item title="隐私政策" border link></uv-list-item>
      <uv-list-item title="公司简介" border link></uv-list-item>
      <uv-list-item title="意见反馈" border link></uv-list-item>
    </uv-list>
    <view class="operate-button"> </view>

    <uv-button type="error" @click="logout">退出登录</uv-button>
  </view>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'

export default {
  name: 'userInfo',
  components: {},
  mixins: [],
  props: {},
  data() {
    return {}
  },
  // 侦听属性
  watch: {},
  // 计算属性
  computed: {
    ...mapGetters(['userInfo']),
  },
  // 监听页面加载，该钩子被调用时data,computed,function,watch,props,slots已设置完成
  onLoad(options) {},
  // 监听页面显示，页面每次出现在屏幕上都触发
  onShow() {},
  // 监听页面初次渲染完成，此时组件已挂载完成
  onReady() {},
  // 下拉刷新
  onPullDownRefresh() {},
  // 加载更多
  onReachBottom() {},

  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    ...mapActions('user', ['Logout']),

    logout() {
      uni.showModal({
        title: '提示',
        content: '确定要退出当前的登录状态吗？',
        success: (res) => {
          if (res.confirm) {
            this.Logout()
            this.$ROUTE.go('/pages/main/home')
          }
        },
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.#{prefixCls('user-info-container')} {
  position: relative;
  padding: 64rpx 30rpx;
  .operate-button {
    margin-top: 60rpx;
  }
}
</style>
